package com.zcx.qshop.view;

import android.content.Context;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.facebook.drawee.view.SimpleDraweeView;
import com.zcx.helper.pager.CarouselChild;
import com.zcx.qshop.QSApplication;
import com.zcx.qshop.R;
import com.zcx.qshop.conn.JsonGoodinfoAsyGet;

/**
 * Created by Administrator on 2015/9/13 0013.
 */
public class PicurlDetailBannerView extends CarouselChild<JsonGoodinfoAsyGet.Info.Picurl> {

    private LayoutInflater layoutInflater;

    public PicurlDetailBannerView(Context context, AttributeSet attrs) {

        super(context, attrs);

        layoutInflater = LayoutInflater.from(context);

    }

    @Override
    protected boolean isPlay() {

        return false;

    }

    @Override
    protected View getView(JsonGoodinfoAsyGet.Info.Picurl picurl) {

        View view = QSApplication.ScaleScreenHelper.loadView((ViewGroup) layoutInflater.inflate(R.layout.item_commodity_detail_banner, null));

        SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.item_commodity_detail_banner_img);

        simpleDraweeView.setImageURI(Uri.parse(picurl.picurl));

        return view;

    }

    @Override
    protected View indicatorLayout(LinearLayout indicatorLayout) {

        int temp = QSApplication.ScaleScreenHelper.getWidthHeight(15);

        indicatorLayout.setGravity(Gravity.CENTER);

        indicatorLayout.setPadding(temp, temp, temp, temp);

        return indicatorLayout;

    }

}
